
package com.zjxd.business.web.api.order;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zjxd.business.web.code.ApiResultCode;
import com.zjxd.business.web.common.ApiResult;
import com.zjxd.business.web.common.BaseController;

/**
 * 订单管理
 * 
 * @author dj 2018/07/03
 */
@RestController
@RequestMapping("api/tBOrder")
public class TBOrderController extends BaseController {

	@RequestMapping("listPage")
	public ApiResult listPage(OrderModel model) {

		return tBOrderService.listPage(model);
	}

	/**
	 * 导出订单信息
	 * 
	 * @return
	 */
	@RequestMapping(value = "/export", method = RequestMethod.POST)
	public ApiResult export(HttpServletRequest request, String ids, String orderstate, HttpServletResponse response) {

		if (ids == null || ids == "") { return ApiResult.fail(ApiResultCode.parameter_error_code); }
		int falge = tBOrderService.export(ids, orderstate, response);
		if (falge > 0) {
			return ApiResult.success("导出成功!");
		} else {
			return ApiResult.fail(ApiResultCode.fail_code);
		}
	}
}